package com.slz3.business.module.messageManagement.mesTemplate.steward;

import com.slz3.business.module.messageManagement.mesTemplate.domain.MesTemplate;
import com.slz3.business.module.messageManagement.mesTemplate.domain.MesTemplateCondition;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

@Component
public class MesTemplateResponse {

    @Resource
    private MesTemplateResController mesTemplateResController;

    public Mono<ServerResponse> add(ServerRequest req) {
        return req.bodyToMono(MesTemplate.class).flatMap(mesTemplate ->
                mesTemplateResController.add(req, mesTemplate)
        );
    }

    public Mono<ServerResponse> delete(ServerRequest req) {
        return req.bodyToMono(MesTemplateCondition.class).flatMap(mesTemplateCondition ->
                mesTemplateResController.delete(req, mesTemplateCondition)
        );
    }

    public Mono<ServerResponse> modify(ServerRequest req) {
        return req.bodyToMono(MesTemplate.class).flatMap(mesTemplate ->
                mesTemplateResController.modify(req, mesTemplate)
        );
    }


    public Mono<ServerResponse> list(ServerRequest req) {
        return mesTemplateResController.list(req);
    }

    public Mono<ServerResponse> info(ServerRequest req) {
        return mesTemplateResController.info(req);
    }

    public Mono<ServerResponse> choice(ServerRequest req) {
        return mesTemplateResController.choice(req);
    }

    public Mono<ServerResponse> auditSubmit(ServerRequest req) {
        return req.bodyToMono(MesTemplateCondition.class).flatMap(mesTemplateCondition ->
                mesTemplateResController.auditSubmit(req, mesTemplateCondition)
        );
    }

    public Mono<ServerResponse> audit(ServerRequest req) {
        return req.bodyToMono(MesTemplateCondition.class).flatMap(mesTemplateCondition ->
                mesTemplateResController.audit(req, mesTemplateCondition)
        );
    }

    public Mono<ServerResponse> auditReject(ServerRequest req) {
        return req.bodyToMono(MesTemplateCondition.class).flatMap(mesTemplateCondition ->
                mesTemplateResController.auditReject(req, mesTemplateCondition)
        );
    }

    public Mono<ServerResponse> usingEnable(ServerRequest req) {
        return req.bodyToMono(MesTemplateCondition.class).flatMap(mesTemplateCondition ->
                mesTemplateResController.usingEnable(req, mesTemplateCondition)
        );
    }

    public Mono<ServerResponse> usingDisable(ServerRequest req) {
        return req.bodyToMono(MesTemplateCondition.class).flatMap(mesTemplateCondition ->
                mesTemplateResController.usingDisable(req, mesTemplateCondition)
        );
    }

}
